package com.datastructure.test.validpalindrome;

public class ValidPalindRome {

    public static void main(String[] args) {

    }

    public boolean palindrome (String str) {
        // write code here
        int length = str.length();
        int mid = length/2;
        int time = 0;
        for (int i = 0; i < mid; i++) {
            if(str.charAt(i)!=str.charAt(length-i-1)){
                time++;
                if(time>1){
                    return false;
                }
            }
        }
        return true;
    }

}
